import { useCookies } from "vue3-cookies";
const { cookies } = useCookies();
import { loginPost } from "@/api"

export let login = async (params,type) => {
    let res = await loginPost(params);
    if (res&&res.code == 200) {
        cookies.set("__token", res.data["access_token"]);
        uni.setStorageSync('userInfo',res.data);
        return true;
    } else {
        // if (type == 'button') {
        //     uni.showToast({
        //         title: res.message,
        //         icon: "none",
        //         duration: 3000
        //     })
        // }
        return false
    }
};